<?php $this->load->view('layout/header');?>
<div class="supplier-content-page">
    <div class="product-test-h5">
        <ul class="breadcrumb">
            <li><a href="javascript:;">商品管理</a></li>
            <li class="active"><a href="<?php echo site_url('tourismprovidercategory/grid')?>">类别管理</a></li>
        </ul>
        <div class="product-view-area">
            <p>类别管理</p>
            <a href="<?php echo site_url('tourismprovidercategory/add')?>">添加类别</a>
        </div>
        <?php echo execute_alert_message();?>
        <div class="order-search">
            <form method="get" action="<?php echo site_url('tourismprovidercategory/grid')?>" class="form-horizontal">
                <div class="row">
                    <div class="col-lg-4">
                        <div class="form-group">
                            <label class="col-sm-4 control-label">类别名称</label>
                            <div class="col-xs-7">
                                <input type="text" name="category_name" value="<?php echo trim($this->input->get('category_name'));?>" class="form-control" placeholder="请输入类别名称">
                            </div>
                        </div>
                    </div>
                </div>
                <div class="row search-button">
                    <div class="col-lg-5">
                        <div class="form-group">
                            <label class="col-sm-4 control-label"> </label>
                            <div class="col-xs-7">
                                <button type="submit" class="btn btn-warning">搜索</button>
                                <a href="<?php echo site_url('tourismprovidercategory/grid');?>" class="btn btn-default">重置条件</a>
                            </div>
                        </div>
                    </div>
                </div>
            </form>
        </div>
        <div class="tourism-product-list">
            <div class="order-dan clearfix">
                <ul class="order-httList">
                    <li class="active">
                        <a href="<?php echo site_url('tourismprovidercategory/grid');?>">全部类别</a>
                    </li>
                </ul>
            </div>
            <?php if ( $page_list->num_rows() > 0 ):?>
                <table class="table">
                    <thead>
                        <tr>
                            <th>类别名称</th>
                            <th>主推类</th>
                            <th>排序</th>
                            <th>上下架</th>
                            <th>创建时间</th>
                            <th>操作</th>
                        </tr>
                    </thead>
                    <tbody>
                    <?php foreach( $page_list->result() as $item ):?>
                        <tr>
                            <td><?php echo $item->category_name;?></td>
                            <td>
                                <strong class="text-primary">
                                    <?php echo $item->is_main == '2' ? '是' : '否';?>
                                </strong>
                            </td>
                            <td><?php echo $item->sort;?></td>
                            <td><strong class="text-danger"><?php echo $item->is_on_sale==1?'上架':'下架'; ?></strong></td>
                            <td><?php echo $item->creat_at;?></td>
                            <td class="operate-list">
                                <p>
                                    <a class="btn btn-default btn-xs" href="<?php echo site_url('tourismprovidercategory/edit/'.$item->id)?>">编辑</a>
                                    <a class="btn btn-danger btn-xs" href="<?php echo site_url('tourismprovidercategory/delete/'.$item->id.'/'.$item->is_main)?>" onclick="return confirm('<?php if($item->is_main==2):?>该类别为主推类，删除，店铺主推商品不显示，如若要删除，请尽快选择别的主推类，<?php endif?>确定删除吗')">删除</a>
                                </p>
                               
                                <p>
                                 <?php if ( $item->is_main == 1 ) :?>
                                  <a class="btn btn-warning btn-xs" href="<?php echo site_url('tourismprovidercategory/setMain/'.$item->id)?>" onclick="return confirm('确定要此类作为主推类')">设为主推类</a>
                                 <?php endif;?>
                                 <?php if ($item->is_on_sale == 1) :?>
                                        <a class="btn btn-warning btn-xs" href="<?php echo site_url('tourismprovidercategory/upOrDown/'.$item->id.'/2')?>" onclick="return confirm('<?php if($item->is_main==2):?>该类别为主推类，如果下架，店铺主推商品不显示，如若要下架，请尽快选择别的主推类，<?php endif?>确定要下架操作？')">下架</a>
                                 <?php elseif ($item->is_on_sale ==2) : ?>
                                        <a class="btn btn-warning btn-xs" href="<?php echo site_url('tourismprovidercategory/upOrDown/'.$item->id.'/1')?>" onclick="return confirm('确定要上架操作？')">上架</a>
                                 <?php endif;?>
                                </p>
                               
                            </td>
                        </tr>
                    <?php endforeach ;?>
                    </tbody>
                </table>
                <div class="your-page pagination pagination-right"><?php echo $pg_link;?></div>
            <?php else: ?>
                <div class="none-data">暂无数据</div>
            <?php endif;?>
        </div>
    </div>
</div>
<?php $this->load->view('layout/footer');?>